package com.wodsy.phoenix.dataservice.shoppingcart.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.wodsy.phoenix.datadao.base.IBaseDao;
import com.wodsy.phoenix.datadao.shoppingcart.dao.ShoppingcartDao;
import com.wodsy.phoenix.datadao.shoppingcart.dao.ShoppingcartRedisDao;
import com.wodsy.phoenix.dataobject.shoppingcart.model.Shoppingcart;
import com.wodsy.phoenix.dataservice.base.AbstractBaseService;
import com.wodsy.phoenix.dataservice.shoppingcart.service.ShoppingcartService;



@Service(interfaceClass=ShoppingcartService.class, interfaceName="com.wodsy.phoenix.dataservice.shoppingcart.service.ShoppingcartService" )
public class ShoppingcartServiceImpl  extends AbstractBaseService<Shoppingcart, Long> implements ShoppingcartService {

	@Autowired
	private ShoppingcartDao shoppingcartDao;
	@Autowired
	private ShoppingcartRedisDao shoppingcartRedisDao;
	
	@Override
	protected IBaseDao<Shoppingcart, Long> getIBaseDao() {
		return shoppingcartDao;
	}
	
	@Transactional(readOnly=true)
	@Override
	public Shoppingcart getMyShoppingcartById(Long id) {
		return shoppingcartDao.getMyShoppingcartById(id);
	}
	/**
	 * 暂无需事务控制
	 */
	//@Transactional(readOnly=true)
	@Override
	public Shoppingcart getMyShoppingcartByUid(Integer userId) {
		return shoppingcartRedisDao.getMyShoppingcartByUid(userId);
	}
	/**
	 * 暂无需事务控制
	 */
	@Override
	public Integer addMyShoppingcart(Shoppingcart shoppingcart) {
		return shoppingcartRedisDao.addMyShoppingcart(shoppingcart);
	}
	/**
	 * 暂无需事务控制
	 */
	@Override
	public void updateShoppingcart(Shoppingcart shoppingcart) {
		shoppingcartRedisDao.updateShoppingcart(shoppingcart);
	}
	/**
	 * 暂无需事务控制
	 */
	@Override
	public void delShoppingcart(Integer userId) {
		shoppingcartRedisDao.delShoppingcart(userId);
	}
	
	public static void main(String[] args) {
		com.alibaba.dubbo.container.Main.main(args);
	}

}
